import React, { Component } from "react";

export default class App extends Component {
  state = {
    myText: "初始值",
    val: "初始值",
  };
  render() {
    return (
      <section>
        <div>{this.state.val}</div>
        <input
          type="text"
          defaultValue={this.state.myText}
          onChange={this.handleChange}
        />
      </section>
    );
  }
  handleChange = (event) => {
    this.setState({
      val: event.target.value,
    });
  };
}
